package com.adgox.tiantianbiting.adapter;

import android.view.View;
import android.widget.ImageView;

import com.adgox.tiantianbiting.R;
import com.adgox.tiantianbiting.bean.MessageBean;
import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseMultiItemQuickAdapter;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

public class ActivityAdapter extends BaseMultiItemQuickAdapter<MessageBean.DataBeanX.DataBean,BaseViewHolder> {
    public ActivityAdapter(List<MessageBean.DataBeanX.DataBean> data) {
        super(data);
        addItemType(MessageBean.DataBeanX.DataBean.Data,R.layout.item_activity_message);
        addItemType(MessageBean.DataBeanX.DataBean.Date,R.layout.item_system_date);
    }
    @Override
    protected void convert(BaseViewHolder helper, MessageBean.DataBeanX.DataBean item) {
        switch (helper.getItemViewType()) {
            case MessageBean.DataBeanX.DataBean.Data:
                helper.setText(R.id.textView6,item.getTitle());
                helper.setText(R.id.des,item.getContent());
                ImageView view = helper.getView(R.id.imageView3);
                Glide.with(mContext).load(item.getImageUrl()).into(view);
                break;
            case MessageBean.DataBeanX.DataBean.Date:
                helper.setText(R.id.time, item.getCreateTimeStr());
                break;
        }
    }
}
